<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" lang="zh">
<head th:replace="commons :: head('登录')">
	<title>Messages : Create</title>
</head>

<body>
<div class="container" id="particles" >
	<div class="row">
		<div class="col-md-12">
			<h2 class="text-center animated bounceInDown">大学选课系统</h2>
		</div>
		<div class="col-md-12" style="margin-top: 100px">
			<div class="row">
				<form  id="login_form">
					<div class="form-group">
						<label for="exampleInputEmail1">账号：</label>
						<input type="text" name="account" class="form-control" id="exampleInputEmail1" placeholder="account">
					</div>
					<div class="form-group">
						<label for="exampleInputPassword1">密码：</label>
						<input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="password">
					</div>
					<div class="radio">
						<label class="radio-inline">
							<input type="radio" name="userType" id="inlineRadio1" checked value="student"> 学生
						</label>
						<label class="radio-inline">
							<input type="radio" name="userType" id="inlineRadio2" value="professor"> 教授
						</label>
						<label class="radio-inline">
							<input type="radio" name="userType" id="inlineRadio3" value="registrar"> 管理员
						</label>
					</div>
				</form>
				<button onclick="login()" class="btn btn-default btn-primary">登录</button>
			</div>
		</div>
	</div>
</div>
<div th:replace="commons::footer"></div>
<script>
	function login() {
		$.ajax({
			url:'/login',
			data:$("#login_form").serialize(),
			type:'post',
			success:function (result) {
				console.log(result);
				if (200===result.code){
					alert(result.extend.error)
				}else {
					top.location=result.extend.success;
				}
			}
		})
	}
</script>
</body>
</html>